angular.module('tab-myinfo', [])

.controller 'TabMyinfoCtrl', ($localStorage,Modal,wfConfig,inWeixin,$location,$scope, $state,Toast,$filter,ionicDatePicker,$window, $ionicHistory,$http,$ionicViewSwitcher, userData) ->

  $scope.commit=[];
  $scope.commit.birthday=new Date()
  $scope.crew=$localStorage.crew
  #返回
  $scope.back= ->
    window.history.back()
  #编辑个人资料
  $scope.toEdit= ->
    $scope.editing=true;

  #日期选择
  $scope.datepickerObjectStart = {
    callback: (val)->
      if typeof (val) == 'undefined'
      else
        $scope.commit.birthday = $filter('date')(new Date(val), 'yyyy-MM-dd');
        $scope.datepickerObjectStart.inputDate = new Date(val);
    ,
    inputDate: new Date(),
    titleLabel: '选择日期',
    setLabel: '确定',
    todayLabel: '今天',
    closeLabel: '关闭',
    mondayFirst: false,
    weeksList: ["日", "一", "二", "三", "四", "五", "六"],
    monthsList: ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"],
    templateType: 'popup',
    from: new Date(1900, 8, 1),
    to: new Date(2028, 8, 1),
    showTodayButton: true,
    dateFormat: 'yyyy-MM-dd',
    closeOnSelect: false,
    disableWeekdays: []
  };
  $scope.openDatePickerS = ->
    ionicDatePicker.openDatePicker($scope.datepickerObjectStart);



#  #提交个人资料
#  $scope.commitEdit= ->
#    $http.put('/customer/'+$localStorage.user.id,{
#      gender: $scope.commit.gender
#      name: $scope.commit.name
#      birthday:$scope.commit.birthday
#      idNo: $scope.commit.idNo
#      tel: $scope.commit.tel
#    })
#      .success (resp) ->
#        if resp.code == 0
#          $window.location.reload();
#          Toast.showMsg("修改资料成功")
#        else
#          Toast.showMsg("添加数据失败")
#      .error (resp, status) ->
#        console.log(resp)
#        Toast.showMsg("添加数据失败")



